import {store} from '@/store/Store';
import {Resource} from '@/base/model/Resource';
import {Company} from '@/base/model/Company';
import {CompanyType} from '@/base/model/CompanyType';
import {AccountType} from '@/base/model/AccountType';

export class Validation {
  static check(resource: Resource): boolean {
    const resources = store.state.user.resources;
    return resources.filter(x => x.id === resource.id).length > 0;
  }

  static get isRootCompany() {
    return store.state.user.company.company.type === CompanyType.ROOT;
  }

  static get isRootGeneral() {
    return store.state.user.company.company.type === CompanyType.GENERAL;
  }

  static get isRootAccount() {
    return store.state.user.company.account.type === AccountType.ROOT;
  }
}
